//
//  LZSWebViewViewController.m
//  IOSProject
//
//  Created by Mac on 2018/4/16.
//  Copyright © 2018年 com.linzhisheng. All rights reserved.
//

#import "LZSWebViewViewController.h"


@interface LZSWebViewViewController ()

@end

@implementation LZSWebViewViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor greenColor];
    
//    self.title = @"这是WEBVIEW界面";
    
    UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectZero];
    self.view = webView;
    NSURL *url = [NSURL URLWithString:self.httpStr];
    NSURLRequest *request = [NSURLRequest requestWithURL:url];
    [webView loadRequest:request];
    
    UIButton *presentBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [presentBtn setTitle:@"界面切换" forState:UIControlStateNormal];
    [presentBtn setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
    presentBtn.titleLabel.font = [UIFont systemFontOfSize:12];
    [presentBtn addTarget:self action:@selector(PresentBtnClick:) forControlEvents:UIControlEventTouchUpInside];
    
    [webView addSubview:presentBtn];
    [presentBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.view).mas_offset(20);
        make.right.equalTo(self.view).mas_offset(-20);
        make.size.mas_equalTo(CGSizeMake(50, 50));
    }];
    
    if ([self.status isEqualToString:@"1"]) {
        presentBtn.hidden = YES;
    }else{
        presentBtn.hidden = NO;
    }
    
}

-(void)PresentBtnClick:(UIButton *)btn{
    [self dismissViewControllerAnimated:YES completion:nil];
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
